home *** CD-ROM | disk | FTP | other *** search
/ Internet Pratica / IPRAT_01.iso / ASP / ASPapp Portal / i_smtp.asp < prev    next >
Encoding:
Text File  |  2002-01-27  |  1.6 KB  |  84 lines

  1. <%
  2.  
  3. function sendmail(recipient_name, recipient_address, sender_name, sender_address, subject, body)
  4.  
  5.     on error resume next
  6.  
  7.     dim smtpObj
  8.     set smtpObj = Server.CreateObject("aspSmartMail.SmartMail")
  9.  
  10. '    Mail Server
  11. '    ***********
  12.     smtpObj.Server = "mail.aspapp.com"
  13.  
  14. '    From
  15. '    ****
  16.  
  17.     if sender_name = "" then
  18.  
  19.     smtpObj.SenderName = "ASPapp.com"
  20.     smtpObj.SenderAddress = "webmaster@aspapp.com"
  21.     
  22.     else
  23.     
  24.     smtpObj.SenderName = sender_name
  25.     smtpObj.SenderAddress = sender_address
  26.     
  27.     end if
  28.  
  29. '    To
  30. '    **
  31.     smtpObj.Recipients.Add recipient_address, recipient_name
  32.     
  33.     'Carbon copy
  34. '    ***********
  35.     'smtpObj.CCs.Add "yourfriend2@anydomain.com", "Friend2's name"
  36.  
  37. '    Blind carbon copy
  38. '    *****************
  39.     'smtpObj.BCCs.Add "yourfriend3@anydomain.com", "Friend3's name"
  40.  
  41. '    Reply To
  42. '    ********
  43.     'smtpObj.ReplyTos.Add "yourfriend4@anydomain.com", "Friend4's name"
  44.  
  45. '    Message
  46. '    *******
  47.     smtpObj.Subject = subject
  48.     smtpObj.Body = body
  49.     
  50. '    Parameters
  51. '    **********
  52.     'smtpObj.DateTime = "Wed, 23 febr 2000 12:00 +0600"
  53.     'smtpObj.Organization = "your Society Inc."
  54.     'smtpObj.XMailer = "Your Web Application"
  55.     'smtpObj.Priority = 1
  56.     'smtpObj.ReturnReceipt = false
  57.     'smtpObj.ConfirmRead = true
  58.     'smtpObj.ContentType = "text/plain"
  59.     'smtpObj.Charset = "us-ascii"
  60.     'smtpObj.Encoding = "base64"
  61.  
  62. '    Attached file
  63. '    *************
  64.     'smtpObj.Attachments.Add Server.MapPath("sample.txt"), false
  65.  
  66. '    Send the message
  67. '    ****************
  68.     smtpObj.SendMail
  69.  
  70.     if err.number <> 0 then
  71.  
  72.         sendmail = -1
  73.  
  74.     else
  75.  
  76.         sendmail = 1
  77.  
  78.     end if
  79.  
  80.     set smtpObj = nothing
  81.     
  82. end function
  83.  
  84. %>